#ifndef WKTJSON_H
#define WKTJSON_H

#pragma once

/***********************************************************************
 *
 *   WKT格式几何形状转换为数组集合用于构建Feature和GeoJson
 *
 *************************************************************************/

#include <QString>
#include "model/definecoor.h"

class WktJson
{
public:
    WktJson();
    ~WktJson();

    static Feature::Type parseWkt(const QString &wkt, CoordinatesCollections &coorsCollections);
    static bool parseWkt(const QString &wkt, Coordinate &coor); // "POINT (121.25 40.75)"

    static QString coorToWkt(const Coordinate &coor);
    static Coordinate wktToCoor(const QString &wkt);

private:
    static void parseMutiPolygon(const QStringRef &scoor, CoordinatesCollections &coorsCollections);
    static void parsePolygon(const QStringRef &scoor, CoordinatesCollection &coorsCollection);
    static void parseCoors(const QStringRef &scoor, Coordinates &coors);
};

#endif